﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace 第二课堂评审系统.Models
{
    public class PartnarConfig : IEntityTypeConfiguration<Partnar>
    {
        public void Configure(EntityTypeBuilder<Partnar> builder)
        {
            builder.ToTable("T_Partnar");
            builder.Property(p=>p.Name).HasMaxLength(20);
            builder.Property(p => p.avatorUrl).HasMaxLength(100);
            builder.Property(p => p.searchDirection).HasMaxLength(20);
            builder.Property(p => p.projectDirection).HasMaxLength(20);     
            builder.Property(p => p.innovateDirection).HasMaxLength(20);
            builder.Property(p => p.Description).HasMaxLength(100);
            builder.HasOne(p => p.guideTeacher).WithMany(u=>u.allPartnar);
            
            builder.HasMany(p=>p.members).WithOne(u=>u.partnar);

        }
    }
}
